<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"coderiding.gitee.io","root":"/blog/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="安卓的签名文件在打包的时候需要用到，但是如果项目的经手人变更，然后没有好好的保存证书签名文件，后面如果需要更改，还涉及重新申请配置的问题，建议大家交接的时候一定要检查证书签名的有效性，免得后续出现问题。">
<meta property="og:type" content="article">
<meta property="og:title" content="实战-安卓android制作证书签名文件">
<meta property="og:url" content="https://coderiding.gitee.io/blog/2020/09/12/%E5%AE%9E%E6%88%98-%E5%AE%89%E5%8D%93android%E5%88%B6%E4%BD%9C%E8%AF%81%E4%B9%A6%E7%AD%BE%E5%90%8D%E6%96%87%E4%BB%B6/index.html">
<meta property="og:site_name" content="汶的博客">
<meta property="og:description" content="安卓的签名文件在打包的时候需要用到，但是如果项目的经手人变更，然后没有好好的保存证书签名文件，后面如果需要更改，还涉及重新申请配置的问题，建议大家交接的时候一定要检查证书签名的有效性，免得后续出现问题。">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-09-12T08:03:40.000Z">
<meta property="article:modified_time" content="2020-09-12T09:01:35.722Z">
<meta property="article:author" content="汶">
<meta property="article:tag" content="证书">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://coderiding.gitee.io/blog/2020/09/12/%E5%AE%9E%E6%88%98-%E5%AE%89%E5%8D%93android%E5%88%B6%E4%BD%9C%E8%AF%81%E4%B9%A6%E7%AD%BE%E5%90%8D%E6%96%87%E4%BB%B6/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>实战-安卓android制作证书签名文件 | 汶的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/blog/atom.xml" title="汶的博客" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/blog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">汶的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://coderiding.gitee.io/blog/2020/09/12/%E5%AE%9E%E6%88%98-%E5%AE%89%E5%8D%93android%E5%88%B6%E4%BD%9C%E8%AF%81%E4%B9%A6%E7%AD%BE%E5%90%8D%E6%96%87%E4%BB%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/side_image.png">
      <meta itemprop="name" content="汶">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="汶的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          实战-安卓android制作证书签名文件
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-09-12 16:03:40 / 修改时间：17:01:35" itemprop="dateCreated datePublished" datetime="2020-09-12T16:03:40+08:00">2020-09-12</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/%E6%94%B9%E5%8F%98%E4%B8%96%E7%95%8C/" itemprop="url" rel="index"><span itemprop="name">改变世界</span></a>
                </span>
            </span>

          
            <div class="post-description">安卓的签名文件在打包的时候需要用到，但是如果项目的经手人变更，然后没有好好的保存证书签名文件，后面如果需要更改，还涉及重新申请配置的问题，建议大家交接的时候一定要检查证书签名的有效性，免得后续出现问题。</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>配置环境：<br>1.mac系统<br>2.已安装android studio<br>3.terminal命令窗口执行</p>
<p>流程概述：<br>1.你必须要有个keystore结尾的证书签名文件；<br>2.拿到keystore文件获取SHA1秘钥；<br>3.配置android studio中证书；<br>4.使用获取到的SHA1秘钥，比如用到高德地图中。</p>
<p>&lt; !– more –&gt;</p>
<hr>
<h5 id="第一步：获取一个keystore文件"><a href="#第一步：获取一个keystore文件" class="headerlink" title="第一步：获取一个keystore文件"></a>第一步：获取一个keystore文件</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">格式</span><br><span class="line">keytool -genkey -v -keystore x签名文件名x.keystore -alias x签名文件别名x -keyalg RSA -validity x证书有效期x</span><br></pre></td></tr></table></figure>

<hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">实战</span><br><span class="line">keytool -genkey -v -keystore 51bb.keystore -alias bb -keyalg RSA -validity 365</span><br></pre></td></tr></table></figure>
<hr>
<h5 id="继续"><a href="#继续" class="headerlink" title="继续"></a>继续</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">输入密钥库口令: x6位以上的密码x</span><br><span class="line">再次输入新口令: x6位以上的密码x</span><br><span class="line"></span><br><span class="line">您的名字与姓氏是什么?</span><br><span class="line">[Unknown]: Doublemine</span><br><span class="line"></span><br><span class="line">您的组织单位名称是什么?</span><br><span class="line">[Unknown]: Test</span><br><span class="line"></span><br><span class="line">您的组织名称是什么?</span><br><span class="line">[Unknown]: Test</span><br><span class="line"></span><br><span class="line">您所在的城市或区域名称是什么?</span><br><span class="line">[Unknown]: Test</span><br><span class="line"></span><br><span class="line">您所在的省&#x2F;市&#x2F;自治区名称是什么?</span><br><span class="line">[Unknown]: Test</span><br><span class="line"></span><br><span class="line">该单位的双字母国家&#x2F;地区代码是什么?</span><br><span class="line">[Unknown]: Test</span><br><span class="line"></span><br><span class="line">CN&#x3D;Doublemine, OU&#x3D;Test, O&#x3D;Test, L&#x3D;Test, ST&#x3D;Test, C&#x3D;Test是否正确?</span><br><span class="line">[否]: y</span><br></pre></td></tr></table></figure>
<hr>
<h5 id="第二步：获取keystore中的SHA1"><a href="#第二步：获取keystore中的SHA1" class="headerlink" title="第二步：获取keystore中的SHA1"></a>第二步：获取keystore中的SHA1</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">格式</span><br><span class="line">keytool -v -list -keystore x签名文件名x.keystore -alias x签名文件别名x -keypass 密码 -storepass 密码</span><br></pre></td></tr></table></figure>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">实战</span><br><span class="line">keytool -v -list -keystore 51bb.keystore -alias bb -keypass 66666666 -storepass 66666666</span><br></pre></td></tr></table></figure>

<p>在打印结果中得到SHA1的秘钥，把这个秘钥应用到需要的地方，比如高德地图</p>
<hr>
<h6 id="第三步：在Android-Stduio中打开主moudle的build-gradle文件-在其中的android闭包中键入"><a href="#第三步：在Android-Stduio中打开主moudle的build-gradle文件-在其中的android闭包中键入" class="headerlink" title="第三步：在Android Stduio中打开主moudle的build.gradle文件,在其中的android闭包中键入"></a>第三步：在Android Stduio中打开主moudle的build.gradle文件,在其中的android闭包中键入</h6><ul>
<li>这里我release和debug用的是同一个，你也可以配置成不同的<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">signingConfigs &#123;</span><br><span class="line">        release &#123;</span><br><span class="line">            keyAlias &#39;bb&#39;</span><br><span class="line">            keyPassword &#39;66666666&#39;</span><br><span class="line">            storeFile file(&#39;&#x2F;Users&#x2F;coderiding&#x2F;Documents&#x2F;51bb&#x2F;51bb_keystore&#x2F;51bb.keystore&#39;)</span><br><span class="line">            storePassword &#39;66666666&#39;</span><br><span class="line">        &#125;</span><br><span class="line">		debug &#123;</span><br><span class="line">            keyAlias &#39;bb&#39;</span><br><span class="line">            keyPassword &#39;66666666&#39;</span><br><span class="line">            storeFile file(&#39;&#x2F;Users&#x2F;coderiding&#x2F;Documents&#x2F;51bb&#x2F;51bb_keystore&#x2F;51bb.keystore&#39;)</span><br><span class="line">            storePassword &#39;66666666&#39;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/blog/tags/%E8%AF%81%E4%B9%A6/" rel="tag"># 证书</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/blog/2020/08/22/%E5%BC%80%E5%8F%91Awesomes%E7%B3%BB%E5%88%97%E5%90%88%E9%9B%86/" rel="prev" title="开发Awesomes系列合集">
      <i class="fa fa-chevron-left"></i> 开发Awesomes系列合集
    </a></div>
      <div class="post-nav-item">
    <a href="/blog/2020/09/14/%E7%A7%BB%E5%8A%A8APP%E6%B7%B7%E5%90%88%E6%A1%86%E6%9E%B6/" rel="next" title="移动APP混合框架">
      移动APP混合框架 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-5"><a class="nav-link" href="#%E7%AC%AC%E4%B8%80%E6%AD%A5%EF%BC%9A%E8%8E%B7%E5%8F%96%E4%B8%80%E4%B8%AAkeystore%E6%96%87%E4%BB%B6"><span class="nav-number">1.</span> <span class="nav-text">第一步：获取一个keystore文件</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E7%BB%A7%E7%BB%AD"><span class="nav-number">2.</span> <span class="nav-text">继续</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#%E7%AC%AC%E4%BA%8C%E6%AD%A5%EF%BC%9A%E8%8E%B7%E5%8F%96keystore%E4%B8%AD%E7%9A%84SHA1"><span class="nav-number">3.</span> <span class="nav-text">第二步：获取keystore中的SHA1</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#%E7%AC%AC%E4%B8%89%E6%AD%A5%EF%BC%9A%E5%9C%A8Android-Stduio%E4%B8%AD%E6%89%93%E5%BC%80%E4%B8%BBmoudle%E7%9A%84build-gradle%E6%96%87%E4%BB%B6-%E5%9C%A8%E5%85%B6%E4%B8%AD%E7%9A%84android%E9%97%AD%E5%8C%85%E4%B8%AD%E9%94%AE%E5%85%A5"><span class="nav-number">3.1.</span> <span class="nav-text">第三步：在Android Stduio中打开主moudle的build.gradle文件,在其中的android闭包中键入</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="汶"
      src="/blog/images/side_image.png">
  <p class="site-author-name" itemprop="name">汶</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">6</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">分类</span>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">5</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/codeRiding" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;codeRiding" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://weibo.com/coderiding" title="Weibo → https:&#x2F;&#x2F;weibo.com&#x2F;coderiding" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>Weibo</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">汶</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>




  















  

  

</body>
</html>
